package com.onec.service.api.component;

import cn.hutool.extra.mail.MailUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author onec
 */
@Slf4j
@Component
public class EmailUtils {


    /**
     * 发送邮件
     *
     * @param subject
     * @param content
     * @param email
     */
    @Async
    public void send(String subject, String content, List<String> email) {
        log.info("发送邮件地址：{},主题：{}", email, subject);
        String messageId = MailUtil.send(email, subject, content, false);
        log.info("发送邮件地址：{},结果：{}", email, messageId);
    }

}
